import Vue from 'vue'
import axios from 'axios'

axios.defaults.baseURL = 'http://127.0.0.1:3000/api/'

axios.interceptors.response.use(function(response){
    return response.data
})
axios.interceptors.request.use(function(request){
    var tokenString =localStorage.getItem('log_list') || '{}'
    var token = JSON.parse(tokenString).token
    if(token){
        request.headers.Authorization =token
    }
    return request
})

Vue.prototype.$http = axios
export default axios